package org.puppet.game.map;

import android.graphics.Bitmap;
import android.graphics.Path;
import android.graphics.Region;
import android.graphics.Path.Direction;

public class MapBlock {
	
	public float x;
	public float y;
	
	public int width;
	public int height;
	
	public float screenX;
	public float screenY;
	

	public Path path=new Path();

	private Bitmap mapImage;
	protected Region region=new Region();

	public MapBlock() {}
	public MapBlock(float x,float y) {
		this.x=x;
		this.y=y;
	}
	public MapBlock(Bitmap mapImage) {
		setMapImage(mapImage);
	}

	public MapBlock(Bitmap mapImage,float x,float y) {
		this(x,y);
		setMapImage(mapImage);
	}
	public Bitmap getMapImage() {
		return mapImage;
	}
	public void setMapImage(Bitmap mapImage) {
		this.mapImage = mapImage;
		width=mapImage.width();
		height=mapImage.height();
		path.reset();
		path.addRect((int)x, (int)y, (int)x+width, (int)y+height, Direction.CW);
		path.close();
	}
	

	public Region getRegion() {
		region.setPath(path);
		return region;
	}

	public Path getPath() {
		return path;
	}
	public void setPath(Path path) {
		this.path = path;
		this.region.setPath(path);
	}

}
